clear 
cd "${path}"

use "${path}/Data/PSID_individual_raw_data.dta" , replace

* Keep only mothers
gen mom_id = ER30001*1000+ER30002
sort mom_id
cd "${path}"
merge 1:m mom_id using Data/ig_links_nocds_ad.dta
keep if _merge==3
drop _merge
duplicates drop mom_id, force

* Rename the household id variable

rename ER30001 intnr68
rename ER30020 intnr69
rename ER30043 intnr70
rename ER30067 intnr71
rename ER30091 intnr72
rename ER30117 intnr73
rename ER30138 intnr74
rename ER30160 intnr75
rename ER30188 intnr76
rename ER30217 intnr77
rename ER30246 intnr78
rename ER30283 intnr79
rename ER30313 intnr80
rename ER30343 intnr81
rename ER30373 intnr82
rename ER30399 intnr83
rename ER30429 intnr84
rename ER30463 intnr85
rename ER30498 intnr86
rename ER30535 intnr87
rename ER30570 intnr88
rename ER30606 intnr89
rename ER30642 intnr90
rename ER30689 intnr91
rename ER30733 intnr92
rename ER30806 intnr93
rename ER33101 intnr94
rename ER33201 intnr95
rename ER33301 intnr96
rename ER33401 intnr97
rename ER33501 intnr99
rename ER33601 intnr101
rename ER33701 intnr103
rename ER33801 intnr105
rename ER33901 intnr107
rename ER34001 intnr109
rename ER34101 intnr111
rename ER34201 intnr113
rename ER34301 intnr115
rename ER34501 intnr117

	* Merge family/household variablers
	set more off, permanently
	cd "Raw/PSID fam"
	forval t=68/93 {
	local y=1900+`t'
	cd fam`y'
	merge m:1 intnr`t' using fam`y', keep(match master) nogen
	local s = `t'-1
	rename intnr`t' intnrdad`s'
	cd ..
	}
	forval t=94/97 {
	local y=1900+`t'
	cd fam`y'er
	merge m:1 intnr`t' using fam`y', keep(match master) nogen
	local s = `t'-1
	rename intnr`t' intnrdad`s'
	cd ..
	}
	forval t=99(2)117 {
	local y=1900+`t'
	cd fam`y'er
	merge m:1 intnr`t' using fam`y', keep(match master) nogen
	local s = `t'-1
	rename intnr`t' intnrdad`s'
	cd ..
	}

* Rename sex variable

rename ER32000 SEXDAD

* Rename the sequence number for moms
* Sequence number corresponds to previous year (note there is no seq. no. for 1968 -> 1967)

rename ER30021 SEQNODADS68
rename ER30044 SEQNODADS69
rename ER30068 SEQNODADS70
rename ER30092 SEQNODADS71
rename ER30118 SEQNODADS72
rename ER30139 SEQNODADS73
rename ER30161 SEQNODADS74
rename ER30189 SEQNODADS75
rename ER30218 SEQNODADS76
rename ER30247 SEQNODADS77
rename ER30284 SEQNODADS78
rename ER30314 SEQNODADS79
rename ER30344 SEQNODADS80
rename ER30374 SEQNODADS81
rename ER30400 SEQNODADS82
rename ER30430 SEQNODADS83
rename ER30464 SEQNODADS84
rename ER30499 SEQNODADS85
rename ER30536 SEQNODADS86
rename ER30571 SEQNODADS87
rename ER30607 SEQNODADS88
rename ER30643 SEQNODADS89
rename ER30690 SEQNODADS90
rename ER30734 SEQNODADS91
rename ER30807 SEQNODADS92
rename ER33102 SEQNODADS93
rename ER33202 SEQNODADS94
rename ER33302 SEQNODADS95
rename ER33402 SEQNODADS96
rename ER33502 SEQNODADS98
rename ER33602 SEQNODADS100
rename ER33702 SEQNODADS102
rename ER33802 SEQNODADS104
rename ER33902 SEQNODADS106
rename ER34002 SEQNODADS108
rename ER34102 SEQNODADS110
rename ER34202 SEQNODADS112
rename ER34302 SEQNODADS114
rename ER34502 SEQNODADS116

* Relation to head variable

rename ER30003 RELDAD67
rename ER30022 RELDAD68
rename ER30045 RELDAD69
rename ER30069 RELDAD70
rename ER30093 RELDAD71
rename ER30119 RELDAD72
rename ER30140 RELDAD73
rename ER30162 RELDAD74
rename ER30190 RELDAD75
rename ER30219 RELDAD76
rename ER30248 RELDAD77
rename ER30285 RELDAD78
rename ER30315 RELDAD79
rename ER30345 RELDAD80
rename ER30375 RELDAD81
rename ER30401 RELDAD82
rename ER30431 RELDAD83
rename ER30465 RELDAD84
rename ER30500 RELDAD85
rename ER30537 RELDAD86
rename ER30572 RELDAD87
rename ER30608 RELDAD88
rename ER30644 RELDAD89
rename ER30691 RELDAD90
rename ER30735 RELDAD91
rename ER30808 RELDAD92
rename ER33103 RELDAD93
rename ER33203 RELDAD94
rename ER33303 RELDAD95
rename ER33403 RELDAD96
rename ER33503 RELDAD98
rename ER33603 RELDAD100
rename ER33703 RELDAD102
rename ER33803 RELDAD104
rename ER33903 RELDAD106
rename ER34003 RELDAD108
rename ER34103 RELDAD110
rename ER34203 RELDAD112
rename ER34303 RELDAD114
rename ER34503 RELDAD116

* Total FAMILY MONEY INCOME 

rename V81 FMONEYDAD67 
rename V529 FMONEYDAD68
rename V1514 FMONEYDAD69
rename V2226 FMONEYDAD70
rename V2852 FMONEYDAD71
rename V3256 FMONEYDAD72
rename V3676 FMONEYDAD73
rename V4154 FMONEYDAD74
rename V5029 FMONEYDAD75
rename V5626 FMONEYDAD76
rename V6173 FMONEYDAD77
rename V6766 FMONEYDAD78
rename V7412 FMONEYDAD79
rename V8065 FMONEYDAD80
rename V8689 FMONEYDAD81
rename V9375 FMONEYDAD82
rename V11022 FMONEYDAD83
rename V12371 FMONEYDAD84
rename V13623 FMONEYDAD85
rename V14670 FMONEYDAD86
rename V16144 FMONEYDAD87
rename V17533 FMONEYDAD88
rename V18875 FMONEYDAD89
rename V20175 FMONEYDAD90
rename V21481 FMONEYDAD91
rename V23322 FMONEYDAD92
rename ER4153 FMONEYDAD93
rename ER6993 FMONEYDAD94
rename ER9244 FMONEYDAD95
rename ER12079 FMONEYDAD96
rename ER16462 FMONEYDAD98
rename ER20456 FMONEYDAD100
rename ER24099 FMONEYDAD102
rename ER28037 FMONEYDAD104
rename ER41027 FMONEYDAD106
rename ER46935 FMONEYDAD108
rename ER52343 FMONEYDAD110
rename ER58152  FMONEYDAD112		
rename ER65349 FMONEYDAD114		
rename ER71426 FMONEYDAD116	

* Rename reported age variables for sons (heads)

rename V117 AGEDADHEAD68
rename V1008 AGEDADHEAD69
rename V1239 AGEDADHEAD70
rename V1942 AGEDADHEAD71
rename V2542 AGEDADHEAD72
rename V3095 AGEDADHEAD73
rename V3508 AGEDADHEAD74
rename V3921 AGEDADHEAD75
rename V4436 AGEDADHEAD76
rename V5350 AGEDADHEAD77
rename V5850 AGEDADHEAD78
rename V6462 AGEDADHEAD79
rename V7067 AGEDADHEAD80
rename V7658 AGEDADHEAD81
rename V8352 AGEDADHEAD82
rename V8961 AGEDADHEAD83
rename V10419 AGEDADHEAD84
rename V11606 AGEDADHEAD85
rename V13011 AGEDADHEAD86
rename V14114 AGEDADHEAD87
rename V15130 AGEDADHEAD88
rename V16631 AGEDADHEAD89
rename V18049 AGEDADHEAD90
rename V19349 AGEDADHEAD91
rename V20651 AGEDADHEAD92
rename V22406 AGEDADHEAD93
rename ER2007 AGEDADHEAD94
rename ER5006 AGEDADHEAD95
rename ER7006 AGEDADHEAD96
rename ER10009 AGEDADHEAD97
rename ER13010 AGEDADHEAD99
rename ER17013 AGEDADHEAD101
rename ER21017 AGEDADHEAD103
rename ER25017 AGEDADHEAD105
rename ER36017 AGEDADHEAD107
rename ER42017 AGEDADHEAD109
rename ER47317 AGEDADHEAD111
rename ER53017 AGEDADHEAD113	
rename ER60017 AGEDADHEAD115	
rename ER66017 AGEDADHEAD117

* Rename reported age variables for moms ("wives")

rename V118 AGEDADWIFE68
rename V1011 AGEDADWIFE69
rename V1241 AGEDADWIFE70
rename V1944 AGEDADWIFE71
rename V2544 AGEDADWIFE72
rename V3097 AGEDADWIFE73
rename V3510 AGEDADWIFE74
rename V3923 AGEDADWIFE75
rename V4438 AGEDADWIFE76
rename V5352 AGEDADWIFE77
rename V5852 AGEDADWIFE78
rename V6464 AGEDADWIFE79
rename V7069 AGEDADWIFE80
rename V7660 AGEDADWIFE81
rename V8354 AGEDADWIFE82
rename V8963 AGEDADWIFE83
rename V10421 AGEDADWIFE84
rename V11608 AGEDADWIFE85
rename V13013 AGEDADWIFE86
rename V14116 AGEDADWIFE87
rename V15132 AGEDADWIFE88
rename V16633 AGEDADWIFE89
rename V18051 AGEDADWIFE90
rename V19351 AGEDADWIFE91
rename V20653 AGEDADWIFE92
rename V22408 AGEDADWIFE93
rename ER2009 AGEDADWIFE94
rename ER5008 AGEDADWIFE95
rename ER7008 AGEDADWIFE96
rename ER10011 AGEDADWIFE97
rename ER13012 AGEDADWIFE99
rename ER17015 AGEDADWIFE101
rename ER21019 AGEDADWIFE103
rename ER25019 AGEDADWIFE105
rename ER36019 AGEDADWIFE107
rename ER42019 AGEDADWIFE109
rename ER47319 AGEDADWIFE111
rename ER53019 AGEDADWIFE113	
rename ER60019 AGEDADWIFE115	
rename ER66019 AGEDADWIFE117

* Rename education variable

rename ER30010 EDUDAD67
rename ER30052 EDUDAD69
rename ER30076 EDUDAD70
rename ER30100 EDUDAD71
rename ER30126 EDUDAD72
rename ER30147 EDUDAD73
rename ER30169 EDUDAD74
rename ER30197 EDUDAD75
rename ER30226 EDUDAD76
rename ER30255 EDUDAD77
rename ER30296 EDUDAD78
rename ER30326 EDUDAD79
rename ER30356 EDUDAD80
rename ER30384 EDUDAD81
rename ER30413 EDUDAD82
rename ER30443 EDUDAD83
rename ER30478 EDUDAD84
rename ER30513 EDUDAD85
rename ER30549 EDUDAD86
rename ER30584 EDUDAD87
rename ER30620 EDUDAD88
rename ER30657 EDUDAD89
rename ER30703 EDUDAD90
rename ER30748 EDUDAD91
rename ER30820 EDUDAD92
rename ER33115 EDUDAD93
rename ER33215 EDUDAD94
rename ER33315 EDUDAD95
rename ER33415 EDUDAD96
rename ER33516 EDUDAD98
rename ER33616 EDUDAD100
rename ER33716 EDUDAD102
rename ER33817 EDUDAD104
rename ER33917 EDUDAD106
rename ER34020 EDUDAD108
rename ER34119 EDUDAD110
rename ER34230 EDUDAD112
rename ER34349 EDUDAD114
rename ER34548 EDUDAD116

* AND WE ALSO TAKE INTO ACCOUNT RACE OF HEAD

rename V181 RACEH67		
rename V801 RACEH68	
rename V1490 RACEH69	
rename V2202 RACEH70	
rename V2828 RACEH71	
rename V3300 RACEH72	
rename V3720 RACEH73	
rename V4204 RACEH74	
rename V5096 RACEH75	
rename V5662 RACEH76	
rename V6209 RACEH77	
rename V6802 RACEH78	
rename V7447 RACEH79	
rename V8099 RACEH80	
rename V8723 RACEH81	
rename V9408 RACEH82	
rename V11055 RACEH83	
rename V11938 RACEH84	
rename V13565 RACEH85	
rename V14612 RACEH86	
rename V16086 RACEH87	
rename V17483 RACEH88	
rename V18814 RACEH89	
rename V20114 RACEH90	
rename V21420 RACEH91	
rename V23276 RACEH92	
rename ER3944 RACEH93	
rename ER6814 RACEH94	
rename ER9060 RACEH95	
rename ER11848 RACEH96	
rename ER15928 RACEH98	
rename ER19989 RACEH100	
rename ER23426 RACEH102	
rename ER27393 RACEH104	
rename ER40565 RACEH106	
rename ER46543 RACEH108	
rename ER51904 RACEH110	
rename ER57659 RACEH112	
rename ER64810 RACEH114	
rename ER70882 RACEH116	

* Rename race of "wife" variable

rename V12293 RACEW84	
rename V13500 RACEW85	
rename V14547 RACEW86	
rename V16021 RACEW87	
rename V17418 RACEW88	
rename V18749 RACEW89	
rename V20049 RACEW90	
rename V21355 RACEW91	
rename V23212 RACEW92	
rename ER3883 RACEW93	
rename ER6753 RACEW94	
rename ER8999 RACEW95	
rename ER11760 RACEW96	
rename ER15836 RACEW98	
rename ER19897 RACEW100	
rename ER23334 RACEW102	
rename ER27297 RACEW104	
rename ER40472 RACEW106	
rename ER46449 RACEW108	
rename ER51810 RACEW110	
rename ER57549 RACEW112	
rename ER64671 RACEW114	
rename ER70744 RACEW116	

* Rename family weight variable

rename V439 FAMWEIGHTDAD67
rename V1014 FAMWEIGHTDAD68
rename V1609 FAMWEIGHTDAD69
rename V2321 FAMWEIGHTDAD70
rename V2968 FAMWEIGHTDAD71
rename V3301 FAMWEIGHTDAD72
rename V3721 FAMWEIGHTDAD73
rename V4224 FAMWEIGHTDAD74
rename V5099 FAMWEIGHTDAD75
rename V5665 FAMWEIGHTDAD76
rename V6212 FAMWEIGHTDAD77
rename V6805 FAMWEIGHTDAD78
rename V7451 FAMWEIGHTDAD79
rename V8103 FAMWEIGHTDAD80
rename V8727 FAMWEIGHTDAD81
rename V9433 FAMWEIGHTDAD82
rename V11079 FAMWEIGHTDAD83
rename V12446 FAMWEIGHTDAD84
rename V13687 FAMWEIGHTDAD85
rename V14737 FAMWEIGHTDAD86
rename V16208 FAMWEIGHTDAD87
rename V17612 FAMWEIGHTDAD88
rename V18943 FAMWEIGHTDAD89
rename V20243 FAMWEIGHTDAD90
rename V21547 FAMWEIGHTDAD91
rename V23361 FAMWEIGHTDAD92
rename ER4160 FAMWEIGHTDAD93
rename ER7000 FAMWEIGHTDAD94
rename ER9251 FAMWEIGHTDAD95
rename ER12084 FAMWEIGHTDAD96
rename ER16518 FAMWEIGHTDAD98
rename ER20394 FAMWEIGHTDAD100
rename ER24179 FAMWEIGHTDAD102
rename ER28078 FAMWEIGHTDAD104
rename ER41069  FAMWEIGHTDAD106 
rename ER47012 FAMWEIGHTDAD108 
rename ER52436 FAMWEIGHTDAD110
rename ER58257 FAMWEIGHTDAD112	
rename ER65492 FAMWEIGHTDAD114	
rename ER71570 FAMWEIGHTDAD116

* Family members

* Rename # family size variable

rename V115 FUMEMBERSDAD68
rename V549 FUMEMBERSDAD69
rename V1238 FUMEMBERSDAD70
rename V1941 FUMEMBERSDAD71
rename V2541 FUMEMBERSDAD72
rename V3094 FUMEMBERSDAD73
rename V3507 FUMEMBERSDAD74
rename V3920 FUMEMBERSDAD75
rename V4435 FUMEMBERSDAD76
rename V5349 FUMEMBERSDAD77
rename V5849 FUMEMBERSDAD78
rename V6461 FUMEMBERSDAD79
rename V7066 FUMEMBERSDAD80
rename V7657 FUMEMBERSDAD81
rename V8351 FUMEMBERSDAD82
rename V8960 FUMEMBERSDAD83
rename V10418 FUMEMBERSDAD84
rename V11605 FUMEMBERSDAD85
rename V13010 FUMEMBERSDAD86
rename V14113 FUMEMBERSDAD87
rename V15129 FUMEMBERSDAD88
rename V16630 FUMEMBERSDAD89
rename V18048 FUMEMBERSDAD90
rename V19348 FUMEMBERSDAD91
rename V20650 FUMEMBERSDAD92
rename V22405 FUMEMBERSDAD93
rename ER2006 FUMEMBERSDAD94
rename ER5005 FUMEMBERSDAD95
rename ER7005 FUMEMBERSDAD96
rename ER10008 FUMEMBERSDAD97
rename ER13009 FUMEMBERSDAD99
rename ER17012 FUMEMBERSDAD01
rename ER21016 FUMEMBERSDAD03
rename ER25016 FUMEMBERSDAD05
rename ER36016 FUMEMBERSDAD07
rename ER42016 FUMEMBERSDAD09
rename ER47316 FUMEMBERSDAD11	
rename ER53016 FUMEMBERSDAD13	
rename ER60016 FUMEMBERSDAD15	
rename ER66016 FUMEMBERSDAD17

* # of kids in family

rename V398 KIDSNUMBERDAD68
rename V550 KIDSNUMBERDAD69
rename V1242 KIDSNUMBERDAD70
rename V1945 KIDSNUMBERDAD71
rename V2545 KIDSNUMBERDAD72
rename V3098 KIDSNUMBERDAD73
rename V3511 KIDSNUMBERDAD74
rename V3924 KIDSNUMBERDAD75
rename V4439 KIDSNUMBERDAD76
rename V5353 KIDSNUMBERDAD77
rename V5853 KIDSNUMBERDAD78
rename V6465 KIDSNUMBERDAD79
rename V7070 KIDSNUMBERDAD80
rename V7661 KIDSNUMBERDAD81
rename V8355 KIDSNUMBERDAD82
rename V8964 KIDSNUMBERDAD83
rename V10422 KIDSNUMBERDAD84
rename V11609 KIDSNUMBERDAD85
rename V13014 KIDSNUMBERDAD86
rename V14117 KIDSNUMBERDAD87
rename V15133 KIDSNUMBERDAD88
rename V16634 KIDSNUMBERDAD89
rename V18052 KIDSNUMBERDAD90
rename V19352 KIDSNUMBERDAD91
rename V20654 KIDSNUMBERDAD92
rename V22409 KIDSNUMBERDAD93
rename ER2010 KIDSNUMBERDAD94
rename ER5009 KIDSNUMBERDAD95
rename ER7009 KIDSNUMBERDAD96
rename ER10012 KIDSNUMBERDAD97
rename ER13013 KIDSNUMBERDAD99
rename ER17016 KIDSNUMBERDAD01
rename ER21020 KIDSNUMBERDAD03
rename ER25020 KIDSNUMBERDAD05
rename ER36020 KIDSNUMBERDAD07
rename ER42020 KIDSNUMBERDAD09
rename ER47320 KIDSNUMBERDAD11	
rename ER53020 KIDSNUMBERDAD13	
rename ER60021 KIDSNUMBERDAD15	
rename ER66021 KIDSNUMBERDAD17

* Rename variables, to match them with previous years

rename KIDSNUMBERDAD68 KIDSNUMBERDAD67
rename KIDSNUMBERDAD69 KIDSNUMBERDAD68
rename KIDSNUMBERDAD70 KIDSNUMBERDAD69
rename KIDSNUMBERDAD71 KIDSNUMBERDAD70
rename KIDSNUMBERDAD72 KIDSNUMBERDAD71
rename KIDSNUMBERDAD73 KIDSNUMBERDAD72
rename KIDSNUMBERDAD74 KIDSNUMBERDAD73
rename KIDSNUMBERDAD75 KIDSNUMBERDAD74
rename KIDSNUMBERDAD76 KIDSNUMBERDAD75
rename KIDSNUMBERDAD77 KIDSNUMBERDAD76
rename KIDSNUMBERDAD78 KIDSNUMBERDAD77
rename KIDSNUMBERDAD79 KIDSNUMBERDAD78
rename KIDSNUMBERDAD80 KIDSNUMBERDAD79
rename KIDSNUMBERDAD81 KIDSNUMBERDAD80
rename KIDSNUMBERDAD82 KIDSNUMBERDAD81
rename KIDSNUMBERDAD83 KIDSNUMBERDAD82
rename KIDSNUMBERDAD84 KIDSNUMBERDAD83
rename KIDSNUMBERDAD85 KIDSNUMBERDAD84
rename KIDSNUMBERDAD86 KIDSNUMBERDAD85
rename KIDSNUMBERDAD87 KIDSNUMBERDAD86
rename KIDSNUMBERDAD88 KIDSNUMBERDAD87
rename KIDSNUMBERDAD89 KIDSNUMBERDAD88
rename KIDSNUMBERDAD90 KIDSNUMBERDAD89
rename KIDSNUMBERDAD91 KIDSNUMBERDAD90
rename KIDSNUMBERDAD92 KIDSNUMBERDAD91
rename KIDSNUMBERDAD93 KIDSNUMBERDAD92
rename KIDSNUMBERDAD94 KIDSNUMBERDAD93
rename KIDSNUMBERDAD95 KIDSNUMBERDAD94
rename KIDSNUMBERDAD96 KIDSNUMBERDAD95
rename KIDSNUMBERDAD97 KIDSNUMBERDAD96
rename KIDSNUMBERDAD99 KIDSNUMBERDAD98
rename KIDSNUMBERDAD01 KIDSNUMBERDAD100
rename KIDSNUMBERDAD03 KIDSNUMBERDAD102
rename KIDSNUMBERDAD05 KIDSNUMBERDAD104
rename KIDSNUMBERDAD07 KIDSNUMBERDAD106
rename KIDSNUMBERDAD09 KIDSNUMBERDAD108
rename KIDSNUMBERDAD11 KIDSNUMBERDAD110
rename KIDSNUMBERDAD13 KIDSNUMBERDAD112
rename KIDSNUMBERDAD15 KIDSNUMBERDAD114
rename KIDSNUMBERDAD17 KIDSNUMBERDAD116

rename FUMEMBERSDAD68 FUMEMBERSDAD67
rename FUMEMBERSDAD69 FUMEMBERSDAD68
rename FUMEMBERSDAD70 FUMEMBERSDAD69
rename FUMEMBERSDAD71 FUMEMBERSDAD70
rename FUMEMBERSDAD72 FUMEMBERSDAD71
rename FUMEMBERSDAD73 FUMEMBERSDAD72
rename FUMEMBERSDAD74 FUMEMBERSDAD73
rename FUMEMBERSDAD75 FUMEMBERSDAD74
rename FUMEMBERSDAD76 FUMEMBERSDAD75
rename FUMEMBERSDAD77 FUMEMBERSDAD76
rename FUMEMBERSDAD78 FUMEMBERSDAD77
rename FUMEMBERSDAD79 FUMEMBERSDAD78
rename FUMEMBERSDAD80 FUMEMBERSDAD79
rename FUMEMBERSDAD81 FUMEMBERSDAD80
rename FUMEMBERSDAD82 FUMEMBERSDAD81
rename FUMEMBERSDAD83 FUMEMBERSDAD82
rename FUMEMBERSDAD84 FUMEMBERSDAD83
rename FUMEMBERSDAD85 FUMEMBERSDAD84
rename FUMEMBERSDAD86 FUMEMBERSDAD85
rename FUMEMBERSDAD87 FUMEMBERSDAD86
rename FUMEMBERSDAD88 FUMEMBERSDAD87
rename FUMEMBERSDAD89 FUMEMBERSDAD88
rename FUMEMBERSDAD90 FUMEMBERSDAD89
rename FUMEMBERSDAD91 FUMEMBERSDAD90
rename FUMEMBERSDAD92 FUMEMBERSDAD91
rename FUMEMBERSDAD93 FUMEMBERSDAD92
rename FUMEMBERSDAD94 FUMEMBERSDAD93
rename FUMEMBERSDAD95 FUMEMBERSDAD94
rename FUMEMBERSDAD96 FUMEMBERSDAD95
rename FUMEMBERSDAD97 FUMEMBERSDAD96
rename FUMEMBERSDAD99 FUMEMBERSDAD98
rename FUMEMBERSDAD01 FUMEMBERSDAD100
rename FUMEMBERSDAD03 FUMEMBERSDAD102
rename FUMEMBERSDAD05 FUMEMBERSDAD104
rename FUMEMBERSDAD07 FUMEMBERSDAD106
rename FUMEMBERSDAD09 FUMEMBERSDAD108
rename FUMEMBERSDAD11 FUMEMBERSDAD110
rename FUMEMBERSDAD13 FUMEMBERSDAD112	
rename FUMEMBERSDAD15 FUMEMBERSDAD114
rename FUMEMBERSDAD17 FUMEMBERSDAD116

rename AGEDADHEAD68 AGEDADHEAD67
rename AGEDADHEAD69 AGEDADHEAD68
rename AGEDADHEAD70 AGEDADHEAD69
rename AGEDADHEAD71 AGEDADHEAD70
rename AGEDADHEAD72 AGEDADHEAD71
rename AGEDADHEAD73 AGEDADHEAD72
rename AGEDADHEAD74 AGEDADHEAD73
rename AGEDADHEAD75 AGEDADHEAD74
rename AGEDADHEAD76 AGEDADHEAD75
rename AGEDADHEAD77 AGEDADHEAD76
rename AGEDADHEAD78 AGEDADHEAD77
rename AGEDADHEAD79 AGEDADHEAD78
rename AGEDADHEAD80 AGEDADHEAD79
rename AGEDADHEAD81 AGEDADHEAD80
rename AGEDADHEAD82 AGEDADHEAD81
rename AGEDADHEAD83 AGEDADHEAD82
rename AGEDADHEAD84 AGEDADHEAD83
rename AGEDADHEAD85 AGEDADHEAD84
rename AGEDADHEAD86 AGEDADHEAD85
rename AGEDADHEAD87 AGEDADHEAD86
rename AGEDADHEAD88 AGEDADHEAD87
rename AGEDADHEAD89 AGEDADHEAD88
rename AGEDADHEAD90 AGEDADHEAD89
rename AGEDADHEAD91 AGEDADHEAD90
rename AGEDADHEAD92 AGEDADHEAD91
rename AGEDADHEAD93 AGEDADHEAD92
rename AGEDADHEAD94 AGEDADHEAD93
rename AGEDADHEAD95 AGEDADHEAD94
rename AGEDADHEAD96 AGEDADHEAD95
rename AGEDADHEAD97 AGEDADHEAD96
rename AGEDADHEAD99 AGEDADHEAD98
rename AGEDADHEAD101 AGEDADHEAD100
rename AGEDADHEAD103 AGEDADHEAD102
rename AGEDADHEAD105 AGEDADHEAD104
rename AGEDADHEAD107 AGEDADHEAD106
rename AGEDADHEAD109 AGEDADHEAD108
rename AGEDADHEAD111 AGEDADHEAD110
rename AGEDADHEAD113 AGEDADHEAD112
rename AGEDADHEAD115 AGEDADHEAD114
rename AGEDADHEAD117 AGEDADHEAD116

rename AGEDADWIFE68 AGEDADWIFE67
rename AGEDADWIFE69 AGEDADWIFE68
rename AGEDADWIFE70 AGEDADWIFE69
rename AGEDADWIFE71 AGEDADWIFE70
rename AGEDADWIFE72 AGEDADWIFE71
rename AGEDADWIFE73 AGEDADWIFE72
rename AGEDADWIFE74 AGEDADWIFE73
rename AGEDADWIFE75 AGEDADWIFE74
rename AGEDADWIFE76 AGEDADWIFE75
rename AGEDADWIFE77 AGEDADWIFE76
rename AGEDADWIFE78 AGEDADWIFE77
rename AGEDADWIFE79 AGEDADWIFE78
rename AGEDADWIFE80 AGEDADWIFE79
rename AGEDADWIFE81 AGEDADWIFE80
rename AGEDADWIFE82 AGEDADWIFE81
rename AGEDADWIFE83 AGEDADWIFE82
rename AGEDADWIFE84 AGEDADWIFE83
rename AGEDADWIFE85 AGEDADWIFE84
rename AGEDADWIFE86 AGEDADWIFE85
rename AGEDADWIFE87 AGEDADWIFE86
rename AGEDADWIFE88 AGEDADWIFE87
rename AGEDADWIFE89 AGEDADWIFE88
rename AGEDADWIFE90 AGEDADWIFE89
rename AGEDADWIFE91 AGEDADWIFE90
rename AGEDADWIFE92 AGEDADWIFE91
rename AGEDADWIFE93 AGEDADWIFE92
rename AGEDADWIFE94 AGEDADWIFE93
rename AGEDADWIFE95 AGEDADWIFE94
rename AGEDADWIFE96 AGEDADWIFE95
rename AGEDADWIFE97 AGEDADWIFE96
rename AGEDADWIFE99 AGEDADWIFE98
rename AGEDADWIFE101 AGEDADWIFE100
rename AGEDADWIFE103 AGEDADWIFE102
rename AGEDADWIFE105 AGEDADWIFE104
rename AGEDADWIFE107 AGEDADWIFE106
rename AGEDADWIFE109 AGEDADWIFE108
rename AGEDADWIFE111 AGEDADWIFE110
rename AGEDADWIFE113 AGEDADWIFE112
rename AGEDADWIFE115 AGEDADWIFE114
rename AGEDADWIFE117 AGEDADWIFE116

* Replace values with missing if not valid 

replace FMONEYDAD93 = . if FMONEYDAD93 == 9999999
replace FMONEYDAD94 = . if FMONEYDAD94 == 9999999
replace FMONEYDAD70 = . if FMONEYDAD70 == 99999
replace FMONEYDAD71 = . if FMONEYDAD71 == 99999
replace FMONEYDAD72 = . if FMONEYDAD72 == 99999
replace FMONEYDAD73 = . if FMONEYDAD73 == 99999
replace FMONEYDAD74 = . if FMONEYDAD74 == 99999
replace FMONEYDAD75 = . if FMONEYDAD75 == 99999
replace FMONEYDAD76 = . if FMONEYDAD76 == 99999
replace FMONEYDAD77 = . if FMONEYDAD77 == 99999
replace FMONEYDAD78 = . if FMONEYDAD78 == 99999

* Create race variable

* For heads

gen FRACEHDAD = RACEH68

replace FRACEHDAD = 1 if RACEH68 == 1
replace FRACEHDAD = . if ((RACEH68 == 0) | (RACEH68 == 9) | (RACEH68 == 8))
replace FRACEHDAD = 0 if ((RACEH68 == 2) | (RACEH68 == 3) | (RACEH68 == 4) | (RACEH68 == 5) | (RACEH68 == 6) | (RACEH68 == 7))

replace FRACEHDAD = 1 if RACEH69 == 1
replace FRACEHDAD = . if ((RACEH69 == 0) | (RACEH69 == 9) | (RACEH69 == 8))
replace FRACEHDAD = 0 if ((RACEH69 == 2) | (RACEH69 == 3) | (RACEH69 == 4) | (RACEH69 == 5) | (RACEH69 == 6) | (RACEH69 == 7))

replace FRACEHDAD = 1 if RACEH70 == 1
replace FRACEHDAD = . if ((RACEH70 == 0) | (RACEH70 == 9) | (RACEH70 == 8))
replace FRACEHDAD = 0 if ((RACEH70 == 2) | (RACEH70 == 3) | (RACEH70 == 4) | (RACEH70 == 5) | (RACEH70 == 6) | (RACEH70 == 7))

replace FRACEHDAD = 1 if RACEH71 == 1
replace FRACEHDAD = . if ((RACEH71 == 0) | (RACEH71 == 9) | (RACEH71 == 8))
replace FRACEHDAD = 0 if ((RACEH71 == 2) | (RACEH71 == 3) | (RACEH71 == 4) | (RACEH71 == 5) | (RACEH71 == 6) | (RACEH71 == 7))

replace FRACEHDAD = 1 if RACEH72 == 1
replace FRACEHDAD = . if ((RACEH72 == 0) | (RACEH72 == 9) | (RACEH72 == 8))
replace FRACEHDAD = 0 if ((RACEH72 == 2) | (RACEH72 == 3) | (RACEH72 == 4) | (RACEH72 == 5) | (RACEH72 == 6) | (RACEH72 == 7))

replace FRACEHDAD = 1 if RACEH73 == 1
replace FRACEHDAD = . if ((RACEH73 == 0) | (RACEH73 == 9) | (RACEH73 == 8))
replace FRACEHDAD = 0 if ((RACEH73 == 2) | (RACEH73 == 3) | (RACEH73 == 4) | (RACEH73 == 5) | (RACEH73 == 6) | (RACEH73 == 7))

replace FRACEHDAD = 1 if RACEH74 == 1
replace FRACEHDAD = . if ((RACEH74 == 0) | (RACEH74 == 9) | (RACEH74 == 8))
replace FRACEHDAD = 0 if ((RACEH74 == 2) | (RACEH74 == 3) | (RACEH74 == 4) | (RACEH74 == 5) | (RACEH74 == 6) | (RACEH74 == 7))

replace FRACEHDAD = 1 if RACEH75 == 1
replace FRACEHDAD = . if ((RACEH75 == 0) | (RACEH75 == 9) | (RACEH75 == 8))
replace FRACEHDAD = 0 if ((RACEH75 == 2) | (RACEH75 == 3) | (RACEH75 == 4) | (RACEH75 == 5) | (RACEH75 == 6) | (RACEH75 == 7))

replace FRACEHDAD = 1 if RACEH76 == 1
replace FRACEHDAD = . if ((RACEH76 == 0) | (RACEH76 == 9) | (RACEH76 == 8))
replace FRACEHDAD = 0 if ((RACEH76 == 2) | (RACEH76 == 3) | (RACEH76 == 4) | (RACEH76 == 5) | (RACEH76 == 6) | (RACEH76 == 7))

replace FRACEHDAD = 1 if RACEH77 == 1
replace FRACEHDAD = . if ((RACEH77 == 0) | (RACEH77 == 9) | (RACEH77 == 8))
replace FRACEHDAD = 0 if ((RACEH77 == 2) | (RACEH77 == 3) | (RACEH77 == 4) | (RACEH77 == 5) | (RACEH77 == 6) | (RACEH77 == 7))

replace FRACEHDAD = 1 if RACEH78 == 1
replace FRACEHDAD = . if ((RACEH78 == 0) | (RACEH78 == 9) | (RACEH78 == 8))
replace FRACEHDAD = 0 if ((RACEH78 == 2) | (RACEH78 == 3) | (RACEH78 == 4) | (RACEH78 == 5) | (RACEH78 == 6) | (RACEH78 == 7))

replace FRACEHDAD = 1 if RACEH79 == 1
replace FRACEHDAD = . if ((RACEH79 == 0) | (RACEH79 == 9) | (RACEH79 == 8))
replace FRACEHDAD = 0 if ((RACEH79 == 2) | (RACEH79 == 3) | (RACEH79 == 4) | (RACEH79 == 5) | (RACEH79 == 6) | (RACEH79 == 7))

replace FRACEHDAD = 1 if RACEH80 == 1
replace FRACEHDAD = . if ((RACEH80 == 0) | (RACEH80 == 9) | (RACEH80 == 8))
replace FRACEHDAD = 0 if ((RACEH80 == 2) | (RACEH80 == 3) | (RACEH80 == 4) | (RACEH80 == 5) | (RACEH80 == 6) | (RACEH80 == 7))

replace FRACEHDAD = 1 if RACEH81 == 1
replace FRACEHDAD = . if ((RACEH81 == 0) | (RACEH81 == 9) | (RACEH81 == 8))
replace FRACEHDAD = 0 if ((RACEH81 == 2) | (RACEH81 == 3) | (RACEH81 == 4) | (RACEH81 == 5) | (RACEH81 == 6) | (RACEH81 == 7))

replace FRACEHDAD = 1 if RACEH82 == 1
replace FRACEHDAD = . if ((RACEH82 == 0) | (RACEH82 == 9) | (RACEH82 == 8))
replace FRACEHDAD = 0 if ((RACEH82 == 2) | (RACEH82 == 3) | (RACEH82 == 4) | (RACEH82 == 5) | (RACEH82 == 6) | (RACEH82 == 7))

replace FRACEHDAD = 1 if RACEH83 == 1
replace FRACEHDAD = . if ((RACEH83 == 0) | (RACEH83 == 9) | (RACEH83 == 8))
replace FRACEHDAD = 0 if ((RACEH83 == 2) | (RACEH83 == 3) | (RACEH83 == 4) | (RACEH83 == 5) | (RACEH83 == 6) | (RACEH83 == 7))

replace FRACEHDAD = 1 if RACEH84 == 1
replace FRACEHDAD = . if ((RACEH84 == 0) | (RACEH84 == 9) | (RACEH84 == 8))
replace FRACEHDAD = 0 if ((RACEH84 == 2) | (RACEH84 == 3) | (RACEH84 == 4) | (RACEH84 == 5) | (RACEH84 == 6) | (RACEH84 == 7))

replace FRACEHDAD = 1 if RACEH85 == 1
replace FRACEHDAD = . if ((RACEH85 == 0) | (RACEH85 == 9) | (RACEH85 == 8))
replace FRACEHDAD = 0 if ((RACEH85 == 2) | (RACEH85 == 3) | (RACEH85 == 4) | (RACEH85 == 5) | (RACEH85 == 6) | (RACEH85 == 7))

replace FRACEHDAD = 1 if RACEH86 == 1
replace FRACEHDAD = . if ((RACEH86 == 0) | (RACEH86 == 9) | (RACEH86 == 8))
replace FRACEHDAD = 0 if ((RACEH86 == 2) | (RACEH86 == 3) | (RACEH86 == 4) | (RACEH86 == 5) | (RACEH86 == 6) | (RACEH86 == 7))

replace FRACEHDAD = 1 if RACEH87 == 1
replace FRACEHDAD = . if ((RACEH87 == 0) | (RACEH87 == 9) | (RACEH87 == 8))
replace FRACEHDAD = 0 if ((RACEH87 == 2) | (RACEH87 == 3) | (RACEH87 == 4) | (RACEH87 == 5) | (RACEH87 == 6) | (RACEH87 == 7))

replace FRACEHDAD = 1 if RACEH88 == 1
replace FRACEHDAD = . if ((RACEH88 == 0) | (RACEH88 == 9) | (RACEH88 == 8))
replace FRACEHDAD = 0 if ((RACEH88 == 2) | (RACEH88 == 3) | (RACEH88 == 4) | (RACEH88 == 5) | (RACEH88 == 6) | (RACEH88 == 7))

replace FRACEHDAD = 1 if RACEH89 == 1
replace FRACEHDAD = . if ((RACEH89 == 0) | (RACEH89 == 9) | (RACEH89 == 8))
replace FRACEHDAD = 0 if ((RACEH89 == 2) | (RACEH89 == 3) | (RACEH89 == 4) | (RACEH89 == 5) | (RACEH89 == 6) | (RACEH89 == 7))

replace FRACEHDAD = 1 if RACEH90 == 1
replace FRACEHDAD = . if ((RACEH90 == 0) | (RACEH90 == 9) | (RACEH90 == 8))
replace FRACEHDAD = 0 if ((RACEH90 == 2) | (RACEH90 == 3) | (RACEH90 == 4) | (RACEH90 == 5) | (RACEH90 == 6) | (RACEH90 == 7))

replace FRACEHDAD = 1 if RACEH91 == 1
replace FRACEHDAD = . if ((RACEH91 == 0) | (RACEH91 == 9) | (RACEH91 == 8))
replace FRACEHDAD = 0 if ((RACEH91 == 2) | (RACEH91 == 3) | (RACEH91 == 4) | (RACEH91 == 5) | (RACEH91 == 6) | (RACEH91 == 7))

replace FRACEHDAD = 1 if RACEH92 == 1
replace FRACEHDAD = . if ((RACEH92 == 0) | (RACEH92 == 9) | (RACEH92 == 8))
replace FRACEHDAD = 0 if ((RACEH92 == 2) | (RACEH92 == 3) | (RACEH92 == 4) | (RACEH92 == 5) | (RACEH92 == 6) | (RACEH92 == 7))

replace FRACEHDAD = 1 if RACEH93 == 1
replace FRACEHDAD = . if ((RACEH93 == 0) | (RACEH93 == 9) | (RACEH93 == 8))
replace FRACEHDAD = 0 if ((RACEH93 == 2) | (RACEH93 == 3) | (RACEH93 == 4) | (RACEH93 == 5) | (RACEH93 == 6) | (RACEH93 == 7))

replace FRACEHDAD = 1 if RACEH94 == 1
replace FRACEHDAD = . if ((RACEH94 == 0) | (RACEH94 == 9) | (RACEH94 == 8))
replace FRACEHDAD = 0 if ((RACEH94 == 2) | (RACEH94 == 3) | (RACEH94 == 4) | (RACEH94 == 5) | (RACEH94 == 6) | (RACEH94 == 7))

replace FRACEHDAD = 1 if RACEH95 == 1
replace FRACEHDAD = . if ((RACEH95 == 0) | (RACEH95 == 9) | (RACEH95 == 8))
replace FRACEHDAD = 0 if ((RACEH95 == 2) | (RACEH95 == 3) | (RACEH95 == 4) | (RACEH95 == 5) | (RACEH95 == 6) | (RACEH95 == 7))

replace FRACEHDAD = 1 if RACEH96 == 1
replace FRACEHDAD = . if ((RACEH96 == 0) | (RACEH96 == 9) | (RACEH96 == 8))
replace FRACEHDAD = 0 if ((RACEH96 == 2) | (RACEH96 == 3) | (RACEH96 == 4) | (RACEH96 == 5) | (RACEH96 == 6) | (RACEH96 == 7))

replace FRACEHDAD = 1 if RACEH98 == 1
replace FRACEHDAD = . if ((RACEH98 == 0) | (RACEH98 == 9) | (RACEH98 == 8))
replace FRACEHDAD = 0 if ((RACEH98 == 2) | (RACEH98 == 3) | (RACEH98 == 4) | (RACEH98 == 5) | (RACEH98 == 6) | (RACEH98 == 7))

replace FRACEHDAD = 1 if RACEH100 == 1
replace FRACEHDAD = . if ((RACEH100 == 0) | (RACEH100 == 9) | (RACEH100 == 8))
replace FRACEHDAD = 0 if ((RACEH100 == 2) | (RACEH100 == 3) | (RACEH100 == 4) | (RACEH100 == 5) | (RACEH100 == 6) | (RACEH100 == 7))

replace FRACEHDAD = 1 if RACEH102 == 1
replace FRACEHDAD = . if ((RACEH102 == 0) | (RACEH102 == 9) | (RACEH102 == 8))
replace FRACEHDAD = 0 if ((RACEH102 == 2) | (RACEH102 == 3) | (RACEH102 == 4) | (RACEH102 == 5) | (RACEH102 == 6) | (RACEH102 == 7))

replace FRACEHDAD = 1 if RACEH104 == 1
replace FRACEHDAD = . if ((RACEH104 == 0) | (RACEH104 == 9) | (RACEH104 == 8))
replace FRACEHDAD = 0 if ((RACEH104 == 2) | (RACEH104 == 3) | (RACEH104 == 4) | (RACEH104 == 5) | (RACEH104 == 6) | (RACEH104 == 7))

replace FRACEHDAD = 1 if RACEH106 == 1
replace FRACEHDAD = . if ((RACEH106 == 0) | (RACEH106 == 9) | (RACEH106 == 8))
replace FRACEHDAD = 0 if ((RACEH106 == 2) | (RACEH106 == 3) | (RACEH106 == 4) | (RACEH106 == 5) | (RACEH106 == 6) | (RACEH106 == 7))

replace FRACEHDAD = 1 if RACEH108 == 1
replace FRACEHDAD = . if ((RACEH108 == 0) | (RACEH108 == 9) | (RACEH108 == 8))
replace FRACEHDAD = 0 if ((RACEH108 == 2) | (RACEH108 == 3) | (RACEH108 == 4) | (RACEH108 == 5) | (RACEH108 == 6) | (RACEH108 == 7))

replace FRACEHDAD = 1 if RACEH110 == 1
replace FRACEHDAD = . if ((RACEH110 == 0) | (RACEH110 == 9) | (RACEH110 == 8))
replace FRACEHDAD = 0 if ((RACEH110 == 2) | (RACEH110 == 3) | (RACEH110 == 4) | (RACEH110 == 5) | (RACEH110 == 6) | (RACEH110 == 7))

replace FRACEHDAD = 1 if RACEH112 == 1
replace FRACEHDAD = . if ((RACEH112 == 0) | (RACEH112 == 9) | (RACEH112 == 8))
replace FRACEHDAD = 0 if ((RACEH112 == 2) | (RACEH112 == 3) | (RACEH112 == 4) | (RACEH112 == 5) | (RACEH112 == 6) | (RACEH112 == 7))

replace FRACEHDAD = 1 if RACEH114 == 1
replace FRACEHDAD = . if ((RACEH114 == 0) | (RACEH114 == 9) | (RACEH114 == 8))
replace FRACEHDAD = 0 if ((RACEH114 == 2) | (RACEH114 == 3) | (RACEH114 == 4) | (RACEH114 == 5) | (RACEH114 == 6) | (RACEH114 == 7))

replace FRACEHDAD = 1 if RACEH116 == 1
replace FRACEHDAD = . if ((RACEH116 == 0) | (RACEH116 == 9) | (RACEH116 == 8))
replace FRACEHDAD = 0 if ((RACEH116 == 2) | (RACEH116 == 3) | (RACEH116 == 4) | (RACEH116 == 5) | (RACEH116 == 6) | (RACEH116 == 7))

drop RACEH*

* For "wives"

gen FRACEWDAD = RACEW85

replace FRACEWDAD = 1 if RACEW85 == 1
replace FRACEWDAD = . if ((RACEW85 == 0) | (RACEW85 == 9) | (RACEW85 == 8))
replace FRACEWDAD = 0 if ((RACEW85 == 2) | (RACEW85 == 3) | (RACEW85 == 4) | (RACEW85 == 5) | (RACEW85 == 6) | (RACEW85 == 7))

replace FRACEWDAD = 1 if RACEW86 == 1
replace FRACEWDAD = . if ((RACEW86 == 0) | (RACEW86 == 9) | (RACEW86 == 8))
replace FRACEWDAD = 0 if ((RACEW86 == 2) | (RACEW86 == 3) | (RACEW86 == 4) | (RACEW86 == 5) | (RACEW86 == 6) | (RACEW86 == 7))

replace FRACEWDAD = 1 if RACEW87 == 1
replace FRACEWDAD = . if ((RACEW87 == 0) | (RACEW87 == 9) | (RACEW87 == 8))
replace FRACEWDAD = 0 if ((RACEW87 == 2) | (RACEW87 == 3) | (RACEW87 == 4) | (RACEW87 == 5) | (RACEW87 == 6) | (RACEW87 == 7))

replace FRACEWDAD = 1 if RACEW88 == 1
replace FRACEWDAD = . if ((RACEW88 == 0) | (RACEW88 == 9) | (RACEW88 == 8))
replace FRACEWDAD = 0 if ((RACEW88 == 2) | (RACEW88 == 3) | (RACEW88 == 4) | (RACEW88 == 5) | (RACEW88 == 6) | (RACEW88 == 7))

replace FRACEWDAD = 1 if RACEW89 == 1
replace FRACEWDAD = . if ((RACEW89 == 0) | (RACEW89 == 9) | (RACEW89 == 8))
replace FRACEWDAD = 0 if ((RACEW89 == 2) | (RACEW89 == 3) | (RACEW89 == 4) | (RACEW89 == 5) | (RACEW89 == 6) | (RACEW89 == 7))

replace FRACEWDAD = 1 if RACEW90 == 1
replace FRACEWDAD = . if ((RACEW90 == 0) | (RACEW90 == 9) | (RACEW90 == 8))
replace FRACEWDAD = 0 if ((RACEW90 == 2) | (RACEW90 == 3) | (RACEW90 == 4) | (RACEW90 == 5) | (RACEW90 == 6) | (RACEW90 == 7))

replace FRACEWDAD = 1 if RACEW91 == 1
replace FRACEWDAD = . if ((RACEW91 == 0) | (RACEW91 == 9) | (RACEW91 == 8))
replace FRACEWDAD = 0 if ((RACEW91 == 2) | (RACEW91 == 3) | (RACEW91 == 4) | (RACEW91 == 5) | (RACEW91 == 6) | (RACEW91 == 7))

replace FRACEWDAD = 1 if RACEW92 == 1
replace FRACEWDAD = . if ((RACEW92 == 0) | (RACEW92 == 9) | (RACEW92 == 8))
replace FRACEWDAD = 0 if ((RACEW92 == 2) | (RACEW92 == 3) | (RACEW92 == 4) | (RACEW92 == 5) | (RACEW92 == 6) | (RACEW92 == 7))

replace FRACEWDAD = 1 if RACEW93 == 1
replace FRACEWDAD = . if ((RACEW93 == 0) | (RACEW93 == 9) | (RACEW93 == 8))
replace FRACEWDAD = 0 if ((RACEW93 == 2) | (RACEW93 == 3) | (RACEW93 == 4) | (RACEW93 == 5) | (RACEW93 == 6) | (RACEW93 == 7))

replace FRACEWDAD = 1 if RACEW94 == 1
replace FRACEWDAD = . if ((RACEW94 == 0) | (RACEW94 == 9) | (RACEW94 == 8))
replace FRACEWDAD = 0 if ((RACEW94 == 2) | (RACEW94 == 3) | (RACEW94 == 4) | (RACEW94 == 5) | (RACEW94 == 6) | (RACEW94 == 7))

replace FRACEWDAD = 1 if RACEW95 == 1
replace FRACEWDAD = . if ((RACEW95 == 0) | (RACEW95 == 9) | (RACEW95 == 8))
replace FRACEWDAD = 0 if ((RACEW95 == 2) | (RACEW95 == 3) | (RACEW95 == 4) | (RACEW95 == 5) | (RACEW95 == 6) | (RACEW95 == 7))

replace FRACEWDAD = 1 if RACEW96 == 1
replace FRACEWDAD = . if ((RACEW96 == 0) | (RACEW96 == 9) | (RACEW96 == 8))
replace FRACEWDAD = 0 if ((RACEW96 == 2) | (RACEW96 == 3) | (RACEW96 == 4) | (RACEW96 == 5) | (RACEW96 == 6) | (RACEW96 == 7))

replace FRACEWDAD = 1 if RACEW98 == 1
replace FRACEWDAD = . if ((RACEW98 == 0) | (RACEW98 == 9) | (RACEW98 == 8))
replace FRACEWDAD = 0 if ((RACEW98 == 2) | (RACEW98 == 3) | (RACEW98 == 4) | (RACEW98 == 5) | (RACEW98 == 6) | (RACEW98 == 7))

replace FRACEWDAD = 1 if RACEW100 == 1
replace FRACEWDAD = . if ((RACEW100 == 0) | (RACEW100 == 9) | (RACEW100 == 8))
replace FRACEWDAD = 0 if ((RACEW100 == 2) | (RACEW100 == 3) | (RACEW100 == 4) | (RACEW100 == 5) | (RACEW100 == 6) | (RACEW100 == 7))

replace FRACEWDAD = 1 if RACEW102 == 1
replace FRACEWDAD = . if ((RACEW102 == 0) | (RACEW102 == 9) | (RACEW102 == 8))
replace FRACEWDAD = 0 if ((RACEW102 == 2) | (RACEW102 == 3) | (RACEW102 == 4) | (RACEW102 == 5) | (RACEW102 == 6) | (RACEW102 == 7))

replace FRACEWDAD = 1 if RACEW104 == 1
replace FRACEWDAD = . if ((RACEW104 == 0) | (RACEW104 == 9) | (RACEW104 == 8))
replace FRACEWDAD = 0 if ((RACEW104 == 2) | (RACEW104 == 3) | (RACEW104 == 4) | (RACEW104 == 5) | (RACEW104 == 6) | (RACEW104 == 7))

replace FRACEWDAD = 1 if RACEW106 == 1
replace FRACEWDAD = . if ((RACEW106 == 0) | (RACEW106 == 9) | (RACEW106 == 8))
replace FRACEWDAD = 0 if ((RACEW106 == 2) | (RACEW106 == 3) | (RACEW106 == 4) | (RACEW106 == 5) | (RACEW106 == 6) | (RACEW106 == 7))

replace FRACEWDAD = 1 if RACEW108 == 1
replace FRACEWDAD = . if ((RACEW108 == 0) | (RACEW108 == 9) | (RACEW108 == 8))
replace FRACEWDAD = 0 if ((RACEW108 == 2) | (RACEW108 == 3) | (RACEW108 == 4) | (RACEW108 == 5) | (RACEW108 == 6) | (RACEW108 == 7))

replace FRACEWDAD = 1 if RACEW110 == 1
replace FRACEWDAD = . if ((RACEW110 == 0) | (RACEW110 == 9) | (RACEW110 == 8))
replace FRACEWDAD = 0 if ((RACEW110 == 2) | (RACEW110 == 3) | (RACEW110 == 4) | (RACEW110 == 5) | (RACEW110 == 6) | (RACEW110 == 7))

replace FRACEWDAD = 1 if RACEW112 == 1
replace FRACEWDAD = . if ((RACEW112 == 0) | (RACEW112 == 9) | (RACEW112 == 8))
replace FRACEWDAD = 0 if ((RACEW112 == 2) | (RACEW112 == 3) | (RACEW112 == 4) | (RACEW112 == 5) | (RACEW112 == 6) | (RACEW112 == 7))

replace FRACEWDAD = 1 if RACEW114 == 1
replace FRACEWDAD = . if ((RACEW114 == 0) | (RACEW114 == 9) | (RACEW114 == 8))
replace FRACEWDAD = 0 if ((RACEW114 == 2) | (RACEW114 == 3) | (RACEW114 == 4) | (RACEW114 == 5) | (RACEW114 == 6) | (RACEW114 == 7))

replace FRACEWDAD = 1 if RACEW116 == 1
replace FRACEWDAD = . if ((RACEW116 == 0) | (RACEW116 == 9) | (RACEW116 == 8))
replace FRACEWDAD = 0 if ((RACEW116 == 2) | (RACEW116 == 3) | (RACEW116 == 4) | (RACEW116 == 5) | (RACEW116 == 6) | (RACEW116 == 7))

* Save wide data
	gen _ER30001=intnrdad67
drop ER*
rename _ER30001 ER30001DAD
save "${path}/Data/moms_data.dta", replace
